{{extend 'layout.html'}}

<h2>Task Monitor (meta)</h2>

{{=A('new regular task',_href=URL('create_task'))}}

<table>
  <tr>
    <th>Id</th>
    <th>Status</th>
    <th>Date Done</th>
    <th>Task_id</th>
    <th>Result</th>
    <th>Traceback</th>
    <th>Actions</th>
  </tr>
  {{for task in tasks:}}
  <tr>
    <td>
      {{=task.id}}
    </td>
    <td style="color: {{=plugin_celery.TASK_STATE_COLORS.get(task.status,'black')}}">
      {{=task.status}}
    </td>
    <td>
      {{=task.date_done}}
    </td>
    <td>
      {{=A(task.task_id,_href=URL('view_task',args=task.task_id))}}
    </td>
    <td>
      {{=task.result and 'DATA' or ''}}
    </td>
    <td>
      {{=task.traceback and 'DATA' or ''}}
    </td>
    <td>
      {{=A('revoke',callback=URL('revoke_task',args=task.task_id))}}
      {{=A('terminate',callback=URL('terminate_task',args=task.task_id))}}
      {{=A('kill',callback=URL('kill_task',args=task.task_id))}}
      {{=A('delete',callback=URL('delete_task',args=task.task_id),delete='tr')}}
    </td>
  </tr>
  {{pass}}
</table>

{{if page>0:}}{{=A('previous',_href=URL(vars=dict(page=page-1)))}}{{pass}}
{{if len(tasks)==100:}}{{=A('next',_href=URL(vars=dict(page=page+1)))}}{{pass}}
